//
//  CAShapeLayer+AWTheme.m
//  changeShin
//
//  Created by Alan Wang on 2019/3/26.
//  Copyright © 2019 Alan Wang. All rights reserved.
//

#import "CAShapeLayer+AWTheme.h"
#import "NSObject+AWTheme.h"

@implementation CAShapeLayer (AWTheme)

-(void)AWTheme_FillColorForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        UIColor * color = [[AWThemeManager shareInstance] colorForKey:key];
        if(color){
            self.fillColor = color.CGColor;
        }
    } forKey:@"fillColor"];
}
-(void)AWTheme_StrokeColorForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        UIColor * color = [[AWThemeManager shareInstance] colorForKey:key];
        if(color){
            self.strokeColor = color.CGColor;
        }
    } forKey:@"strokeColor"];
}
-(void)AWTheme_LineWidthForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        CGFloat lineWidth = [[AWThemeManager shareInstance] floatForKey:key];
        self.lineWidth = lineWidth;
    } forKey:@"lineWidth"];
}

@end
